package br.com.foxinline.modelo;

import br.com.foxinline.generico.EntidadeGenerica;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;

/**
 *
 * @author elyjunior
 */
@Entity
public class Forus extends EntidadeGenerica implements Serializable {

    @Id
    @SequenceGenerator(sequenceName = "seq_forus", name = "seq_forus", allocationSize = 1)
    @GeneratedValue(generator = "seq_forus", strategy = GenerationType.SEQUENCE)
    private Long id;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataForus;
    @DecimalMin(value = "0.00")
    @Digits(fraction = 2, integer = 10)
    @Column(scale = 2, precision = 10)
    private BigDecimal valor;
    private Boolean pago;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataPagamento;
    @ManyToOne
    private Averbacao averbacao;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDataForus() {
        return dataForus;
    }

    public void setDataForus(Date dataForus) {
        this.dataForus = dataForus;
    }

    public BigDecimal getValor() {
        return valor;
    }

    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    public Boolean getPago() {
        return pago;
    }

    public void setPago(Boolean pago) {
        this.pago = pago;
    }

    public Date getDataPagamento() {
        return dataPagamento;
    }

    public void setDataPagamento(Date dataPagamento) {
        this.dataPagamento = dataPagamento;
    }

    public Averbacao getAverbacao() {
        return averbacao;
    }

    public void setAverbacao(Averbacao averbacao) {
        this.averbacao = averbacao;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 13 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 13 * hash + (this.dataForus != null ? this.dataForus.hashCode() : 0);
        hash = 13 * hash + (this.valor != null ? this.valor.hashCode() : 0);
        hash = 13 * hash + (this.pago != null ? this.pago.hashCode() : 0);
        hash = 13 * hash + (this.dataPagamento != null ? this.dataPagamento.hashCode() : 0);
        hash = 13 * hash + (this.averbacao != null ? this.averbacao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Forus other = (Forus) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if (this.dataForus != other.dataForus && (this.dataForus == null || !this.dataForus.equals(other.dataForus))) {
            return false;
        }
        if (this.valor != other.valor && (this.valor == null || !this.valor.equals(other.valor))) {
            return false;
        }
        if (this.pago != other.pago && (this.pago == null || !this.pago.equals(other.pago))) {
            return false;
        }
        if (this.dataPagamento != other.dataPagamento && (this.dataPagamento == null || !this.dataPagamento.equals(other.dataPagamento))) {
            return false;
        }
        if (this.averbacao != other.averbacao && (this.averbacao == null || !this.averbacao.equals(other.averbacao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Forus{" + "id=" + id + ", dataForus=" + dataForus + ", valor=" + valor + ", pago=" + pago + ", dataPagamento=" + dataPagamento + ", averbacao=" + averbacao + '}';
    }
}
